package bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * @Author: admin
 * @Description:
 * @Date: 2019/6/11 18:46
 */

public class BioClient {
    private Socket socket;
    private String ip;
    private int port;
    public BioClient(String ip, int port){
        this.ip=ip;
        this.port=port;
    }
    public void start(){
        try {
            socket=new Socket();
            socket.connect(new InetSocketAddress(ip,port));
            while (true){
                OutputStream outputStream=socket.getOutputStream();
                outputStream.write("asd hello world".getBytes());
                outputStream.flush();
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("=====");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        BioClient bioClient=new BioClient("192.168.10.66",9999);
        bioClient.start();
    }
}
